﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Top.Api;
using Top.Api.Request;
using Top.Api.Response;
using System.Xml;
using Top.Api.Parser;
using CommonFramework.CommonConstant;

namespace MockTaoBaoServices
{
    public class WangWangAPI : BaseAPI
    {
        /// <summary>
        /// 获取关键词列表
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <returns></returns>
        public static WangwangAbstractGetwordlistResponse GetWangwangAbstractGetwordlistResponse(string sessionKey)
        {
            WangwangAbstractGetwordlistRequest req = new WangwangAbstractGetwordlistRequest();
            return client.Execute(req, sessionKey);
        }

        /// <summary>
        /// 客服接待数
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <returns></returns>
        public static WangwangEserviceReceivenumGetResponse GetWangwangEserviceReceivenumGetResponse(DateTime startTime, DateTime endTime, string sessionKey, string nick)
        {
            WangwangEserviceReceivenumGetRequest req = new WangwangEserviceReceivenumGetRequest();
            req.ServiceStaffId = ConfigConstant.CnTaoBao + nick;
            req.StartDate = startTime;
            req.EndDate = endTime;
            return client.Execute(req, sessionKey);
        }

        /// <summary>
        /// 客服未回复人数
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="sessionKey"></param>
        /// <param name="nick"></param>
        /// <returns></returns>
        public static WangwangEserviceNoreplynumGetResponse GetWangwangEserviceNoreplynumGetResponse(DateTime startTime, DateTime endTime, string sessionKey, string nick)
        {
            WangwangEserviceNoreplynumGetRequest req = new WangwangEserviceNoreplynumGetRequest();
            req.ServiceStaffId = ConfigConstant.CnTaoBao + nick;
            req.StartDate = startTime;
            req.EndDate = endTime;
            return client.Execute(req, sessionKey);
        }

        /// <summary>
        /// 获取聊天对象列表
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="sessionKey"></param>
        /// <param name="nick"></param>
        /// <returns></returns>
        public static WangwangEserviceChatpeersGetResponse GetWangwangEserviceChatpeersGetResponse()
        {
            ITopParser tp = new TopXmlParser();
            return tp.Parse<WangwangEserviceChatpeersGetResponse>(BaseAPI.GetMockXml(@"WangWangAPI\chatpeers.xml"));
        }
    }
}
